package com.sfy.course.aggregation.msmapper;


import com.sfy.common.dto.CourseDTO;
import com.sfy.common.dto.InstructorDTO;
import com.sfy.course.aggregation.vo.CourseDetailVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

@Mapper(componentModel = "spring")
public interface MsCourseDetailMapper {

    /**
     * 在每个DTO中都有一个讲师ID，需要指定哪个DTO的id赋值给VO
     * @param courseDTO
     * @param instructorDTO
     * @return
     */
    @Mapping(source = "instructorDTO.instructorId" , target = "instructorId")
    @Mapping(source = "courseDTO.createdAt",target = "createdAt")
    @Mapping(source = "courseDTO.updatedAt",target = "updatedAt")
    CourseDetailVO toCourseDetailVO(CourseDTO courseDTO, InstructorDTO instructorDTO);
}
